#include <iostream>
#include <map>

using namespace std;

bool fncomp(char lhs, char rhs) { return lhs < rhs; }

struct classcomp {
	bool operator()(const char &lhs, const char &rhs) const
	{
		return lhs > rhs;
	}
};

int main(void)
{
	map<char, int> first;
	first['a'] = 10;
	first['d'] = 70;
	first['c'] = 50;
	first['b'] = 30;

	map<char, int> second(first.begin(), first.end());

	map<char, int> third(second);

	map<char, int, classcomp> fourth(first.begin(), first.end());

	bool (*fn_pt)(char, char) = fncomp;
	map<char, int, bool(*)(char, char)> fifth(first.begin(), first.end(), fn_pt);

	cout << "4th:" << endl;
	for (const auto &pair : fourth) {
		cout << "Key: " << pair.first << ", Value: " << pair.second << endl;
	}

	cout << "5th:" << endl;
	for (map<char, int>::iterator it = fifth.begin(); it != fifth.end(); it++)
	{
		cout << "Key: " << it->first << ", Value: " << it->second << endl;
	}

	return 0;
}

